<?php
namespace app\admin\controller;
use app\admin\controller\Base;
use app\common\library\Auth;
use brand\tools\Random;

/**
 * 用户
 */
class User extends Base
{
    public function db_reset($db)
    {
        return new \app\common\model\User();
    }

    public function form_before_build($raw)
    {
        unset($raw['password']);
        unset($raw['salt']);
        return $raw;
    }

    public function submit_save_before($params)
    {
        $params['salt'] = Random::build();
        $params['password'] = Auth::instance()->getEncryptPassword($params['password'],$params['salt']);
        return $params;
    }

}